package com.hmall.common.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ErrorResult {
    private String errCode;
    private String errMessage;

    public static ErrorResult error() {
        return ErrorResult.builder().errCode("999999").errMessage("系统异常稍后再试").build();
    }

    public static ErrorResult stockFail() {
        return ErrorResult.builder().errCode("000001").errMessage("库存不足").build();
    }

    public static ErrorResult searchFail() {
        return ErrorResult.builder().errCode("000002").errMessage("搜索数据失败").build();
    }

    public static ErrorResult suggestionFail() {
        return ErrorResult.builder().errCode("000003").errMessage("自动补全查询失败").build();
    }

    public static ErrorResult aggregationsFail() {
        return ErrorResult.builder().errCode("000004").errMessage("聚合查询失败").build();
    }
}